package ar.edu.ufasta.presupuestos.logica.aplicativo;

import java.awt.BorderLayout;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.swing.JFrame;

import com.adobe.acrobat.Viewer;

public class PDFViewer {

	private String fileName;
	
	public PDFViewer(String fileName) {
		this.fileName = fileName;
	}
	
	public void view(){
		JFrame frame = new JFrame("PDF Viewer");
		frame.setLayout(new BorderLayout());
		Viewer viewer;
		try {
			viewer = new Viewer();
			frame.add(viewer, BorderLayout.CENTER);
			InputStream input =
			    new FileInputStream (new File(
			        this.fileName));
			viewer.setDocumentInputStream(input);
			viewer.activate();
			viewer.zoomTo(1.0);
			frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
			frame.setSize(800, 600);
//			frame.pack(); 
			frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}


	}
	
}
